import allure
from selenium import webdriver
from selenium.webdriver.common.by import By

from src.PO.base import Base
from src.PO.main_page import MainPage


@allure.feature("登陆界面")
class LoginPage(Base):
    __LOGIN_URL="https://litemall.hogwarts.ceshiren.com/#/login"
    __SIGN_IN=(By.CSS_SELECTOR,".el-button.el-button--primary.el-button--mini")

    # def __init__(self):
    #     self.driver=webdriver.Chrome()
    #     self.driver.maximize_window()
    #     self.driver.implicitly_wait(3)

    def click_to_login(self):
        with allure.step("打开页面"):
            self.driver.get(self.__LOGIN_URL)
        with allure.step("点击登录,跳转主界面"):
            # self.driver.find_element(*self.__SIGN_IN).click()
            self.find_and_click(*self.__SIGN_IN)
        return MainPage(self.driver)